import uvicorn
from fastapi import FastAPI
from core.config import settings
from routers import teach, file
from core.exceptions import ApiException,api_exception_handler
import logging

logging.basicConfig(
    filename="app.log",
    level=logging.INFO,
    format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
    datefmt="%Y-%m-%d %H:%M:%S",

    )

app = FastAPI(
    title=settings.APP_NAME,
    version="1.0.0",
    description="教学平台ai中心",
)

app.add_exception_handler(ApiException, api_exception_handler)

app.include_router(teach.router)
app.include_router(file.router)

@app.get("/")
async def root():
    return {
        "message": "欢迎来到教学平台ai中心",
        "version": "1.0.0",
        "available_agents": ["chat"]      
    }
if __name__ == "__main__":
    uvicorn.run(app, port=8000)